<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ page contentType="text/html;charset=utf-8" language="java" %>
<!DOCTYPE HTML>
<html lang="zh-cn">
<head>
    <meta charset="UTF-8">
    <title>用户填写问卷</title>
    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no">
    <link rel="stylesheet" href="https://at.alicdn.com/t/font_289760_kjgrg5zwme9g4x6r.css">
    <link rel="stylesheet" href="lib/bootstrap-3.3.7/dist/css/bootstrap.css">
    <link href="<c:url value="/css/style3.css"/>" rel="stylesheet"/>
    <link rel="stylesheet" href="css/public.css">
    <script src="lib/jquery/jquery-3.2.1.min.js"></script>
    <script src="lib/bootstrap-3.3.7/dist/js/bootstrap.js"></script>

</head>
<body onload="checkForm()">
<div class="container">
    <c:if test="${questionnaire.status == 1}">
    <div class="main">
        <div class="suv-title">
            <p class="suvTitle"><c:out value="${questionnaire.title}"/></p>

            <p class="welcome">感谢您能抽出几分钟时间来参加本次答题，现在我们就马上开始吧！</p>
        </div>
        <div class="text-group">
            <form method="get" action="/questionnaire/submitquestionnaire">
                <input name="questionnaireSChoice" hidden value="${questionnaire.questionnaireId}">
            <c:forEach var="question" items="${questionList}">
                <c:if test="${question.type eq 'SChoice'}">
                    <div class="radio-group">
                        <p> <c:out value="${question.questionNum}"/>. <c:out value="${question.content}"/></p>
                        <c:forEach var="option" items="${optionList}">
                            <c:if test="${option.questionId == question.questionId}">

                                    <div class="radio${option.id}">
                                        <input type="radio" id="${question.questionId}" name="radio${question.content}" value="${question.questionId}/${option.content}">
                                        <label for="${question.questionId}"><c:out value="${option.content}"/></label>
                                    </div>
                            </c:if>
                        </c:forEach>
                    </div>
                </c:if>


                <c:if test="${question.type eq 'Blank'}">
                        <p> <c:out value="${question.questionNum}"/>. <c:out value="${question.content}"/></p>
                        <input type="hidden"  name="radio${question.content}" value="${question.questionId}">
                    <input type="text" name="radio${question.questionNum}" style="width: 100%">
                </c:if>


                <c:if test="${question.type eq 'MChoice'}">
                    <div class="checkbox-group">
                        <p> <c:out value="${question.questionNum}"/>. <c:out value="${question.content}"/></p>
                        <c:forEach var="option" items="${optionList}">
                            <c:if test="${option.questionId == question.questionId}">
                            <div class="checkbox">
                                <input type="checkbox" id="checkbox-1" name="radioM" value="${question.questionId}/${option.content}">
                                <label for="checkbox-1"><c:out value="${option.content}"/></label>
                            </div>
                            </c:if>
                        </c:forEach>
                    </div>
                </c:if>
            </c:forEach>
        </div>
        <script type="text/javascript">
            function checkForm() {
                var flag = '<%=request.getAttribute("message")%>';
                if(flag != "null") {
                    alert(flag);
                    $("#username").attr("value","");
                    $("#password").attr("value","");
                }
            }
        </script>
        <input type="submit" class="submit" value="提交">
<%--        <a href="#" class="submit">提交</a>--%>
        </form>
    </div>
    </c:if>
    <c:if test="${questionnaire.status != 1}">
        <div class="main">
            <div class="suv-title">
                <p class="suvTitle">该问卷尚未编辑完成或审核未通过或还未审核</p>
            </div>
        </div>
    </c:if>
</div>
<div class="main-show-mb">
    <div class="tips">
        您已完成本次问卷，感谢您的帮助与支持
    </div>
</div>

</body>
</html>